package nc.ui.acm.init.initinput;

import nc.ui.acm.bill.singlecardbody.ACMSingleController;
import nc.ui.acm.bill.singlecardbody.SingleCardBodyUI;
import nc.ui.trade.card.CardEventHandler;
import nc.vo.acm.init.initinput.InitInputGetCHK;
import nc.vo.acm.pub.ExcelImpBtnVO;
import nc.vo.acm.pub.ImpTallyBtnVO;
import nc.vo.acm.pub.UnImpTallyBtnVO;
import nc.vo.trade.button.ButtonVO;

public class InitInputUI extends SingleCardBodyUI {

	public InitInputUI() {
		super();
	}

	@Override
	public ACMSingleController createController() {
		return new InitInputCtrl();
	}
	
	@Override
	public CardEventHandler createEventHandler() {
		return new InitInputEH(this, getUIControl());
	}
	
	@Override
	public void setDefaultData() throws Exception {
		super.setDefaultData();
		int row = getBillCardPanel().getBillModel().getRowCount()-1;
		getBillCardPanel().getBillModel().setValueAt(getUIControl().getBillType(), row, "pk_billtype");
		getBillCardPanel().getBillModel().execLoadFormulaByRow(row);
	}
	
	@Override
	public void initData() throws Exception {
		nc.vo.pub.bill.BillRendererVO voCell = new nc.vo.pub.bill.BillRendererVO();
		voCell.setShowZeroLikeNull(false);
		getBillCardPanel().setBodyShowFlags(voCell);

		super.initData();
	}
	
	@Override
	public String getInitSqlWhere() {
		return "";
	}
	
	@Override
	protected void initPrivateButton() {
		super.initPrivateButton();
		ButtonVO excelimp = new ExcelImpBtnVO().getButtonVO();
		ButtonVO imptally = new ImpTallyBtnVO().getButtonVO();
		ButtonVO unimptally = new UnImpTallyBtnVO().getButtonVO();
		
		addPrivateButton(excelimp);
		addPrivateButton(imptally);
		addPrivateButton(unimptally);
	}
	
	@Override
	public Object getUserObject() {
		return new InitInputGetCHK();
	}

}
